<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="/js/axios.min.js"></script>
<script src="/js/util.js"></script>
<script>
    window.onload = function (){
        findAll(1)
    }

    function findAll(pageNO){
        axios.get("/manager/findByItem",{
            params:{
                pageNO,
                status:$('status').value,
                startDate:$('startDate').value,
                endDate:$('endDate').value
            }
        }).then(e => {
            var info = e.data;
            var str = "";
            for (var i=0;i<info.records.length;i++){
                var obj = info.records[i];
                str += `<tr><td>${obj.id}</td><td>${obj.sumPrice}</td><td>${obj.status}</td><td>${obj.orderTime}</td>
                    <td><a href="/manager/orderDatail.html?orderId=${obj.id}">订单详情</a></td></tr>`
            }
            $('orderData').innerHTML = str;
            var pageStr = "";
            for (var i=1;i<=info.pages;i++){
                pageStr += `<a href="javascript:findAll(${i})">${i}</a>`
            }
            $('cutDiv').innerHTML = pageStr;
        })
    }
</script>
<body>
    <h2>管理员界面</h2>
    <table border="1" cellspacing="0" width="60%">
        <thead>
        <tr><td>订单号</td><td>订单总价</td><td>订单状态</td><td>下单时间</td><td>订单详情</td></tr>
        </thead>
        <tbody id="orderData"></tbody>
    </table>
    <div id="cutDiv"></div>
    订单状态:<input type="text" id="status"><br>
    起始日期:<input type="text" id="startDate">
    结束日期:<input type="text" id="endDate">
    <input type="button" onclick="findAll(1)" value="查询">
</body>
</html>